

#include "LEV_PrjDefine.h"



void InitADPControl(){
  ADP_Control_PORT_SEL &= ~(ADP_Control_Pin);
  ADP_Control_PORT_DIR |= (ADP_Control_Pin);  //1: The port pin is switched to output direction, 0: The port pin is switched to input direction
  ADP_Control_PORT_OUT &= ~(ADP_Control_Pin);
  G_Activate_Action_Status_Other1 &= ~ADP_Control_Status;
}
void setADPControlPin(unsigned char enable){
  if(enable){
    ADP_Control_PORT_OUT |= (ADP_Control_Pin);
    G_Activate_Action_Status_Other1 |= ADP_Control_Status;
  }else{
    ADP_Control_PORT_OUT &= ~(ADP_Control_Pin);
    G_Activate_Action_Status_Other1 &= ~ADP_Control_Status;
  }
}

void CheckAndSetChagerVoltage(){
    if(G_Activate_Action_Status_Other1 & SET_SOC_IN_TEMP_RANGE){
        setADPControlPin(true);
        return;
    }
  if(CoulombCyclecount < CYCLECOUNT_FOR_CHG_LEVEL_1){
    setADPControlPin(false);
  }else if(CoulombCyclecount < CYCLECOUNT_FOR_CHG_LEVEL_2) {
    setADPControlPin(true);
  }else{
    setADPControlPin(false);
  }
}

